package net.oschina.app.previousTest;

import android.test.ActivityInstrumentationTestCase2;

import com.robotium.solo.Solo;

import junit.framework.Assert;

import net.oschina.app.AppStart;

/**
 * Created by Administrator on 2017/6/30.
 */

public class GoBackTest extends ActivityInstrumentationTestCase2 {

    private Solo solo;

    public GoBackTest() {
        super(AppStart.class);
    }

    @Override
    public void setUp() throws Exception {
        super.setUp();
        solo = new Solo(getInstrumentation(), getActivity());
    }

    public void testName() throws Exception {
        solo.sleep(3000);
        //点击 我的
        solo.clickOnText("我的");
        //点击 控件 登录
        solo.clickOnText("点击头像登录");
        //点击 第一个文本框控件
        solo.sleep(3000);
        // 硬件返回  就是安卓手机的返回功能
        solo.goBack();
        solo.sleep(3000);
        solo.clickOnText("点击头像登录");
        solo.sleep(30000);

    }

    public void testKeyBoard(){
        solo.sleep(3000);
        solo.clickOnText("我的");
        solo.clickOnText("点击头像登录");
        solo.sleep(3000);
        //隐藏虚拟键盘
        solo.hideSoftKeyboard();
        solo.sleep(3000);
    }

    public void testXXX(){
//        solo.searchEditText("我的");
        solo.sleep(4000);
        //向右滑
        solo.scrollToSide(Solo.RIGHT,0.8f);
        solo.sleep(3000);
        //向下滑
        solo.scrollDown();
        //向上滑
        solo.scrollUp();
        //向下滑倒最底部
        solo.scrollToBottom();
        //向上滑倒最顶部
        solo.scrollToTop();
        //滑到列表第一行 第4列
        solo.scrollListToLine(0,3);
        //向右滑
        solo.scrollToSide(Solo.RIGHT,0.8f);
        //向左滑
        solo.scrollToSide(Solo.LEFT,0.7f);
        //拖动
       // solo.drag();
        solo.sleep(3000);


     /*   //断言
        Assert.assertEquals("","");
        Assert.assertNotSame("","");
        Assert.assertTrue();
        Assert.assertFalse();
        Assert.assertNull();
        Assert.assertNotNull();
        //异常处理
        Assert.fail("此处输入异常信息");*/

    }

    @Override
    public void tearDown() throws Exception {
        solo.finishOpenedActivities();
        super.tearDown();
    }
}
